// index.js
import { getPageData } from '../../api/index/index';
Page({
  /**
   * 页面的初始数据
   */
  data: {
    data: null,
    indexTab: 0,
    swiperImages: [
      {
        picUrl: 'https://img0.baidu.com/it/u=2984434116,3778169627&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333',
      },
      {
        picUrl: 'https://img0.baidu.com/it/u=2984434116,3778169627&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333',
      },
      {
        picUrl: 'https://img0.baidu.com/it/u=2984434116,3778169627&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333',
      }
    ],
    tabList: [
      {
        title: '发现'
      },
      {
        title: '男频'
      },
      {
        title: '女频'
      },
      {
        title: '免费'
      },
      {
        title: '分类'
      },
      {
        title: '排行'
      },
    ]
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    const data = getPageData();
    this.setData({
      data: data,
    })
  },

  jumpPage() {
    wx.navigateTo({
      url: '/pages/web-view/index',
    })
  },

  toggleTab(event) {
    this.setData({indexTab: event.currentTarget.dataset.indextab});
  },
})
